 using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.Entity;
using System.Data.Entity.ModelConfiguration.Conventions;
using CurriculasEntities;

namespace CurriculasDAO
{
    public class EFContext : DbContext
    {
        public EFContext(string cadenaConexion)
            : base(cadenaConexion)
        {
            Database.SetInitializer<EFContext>(null);
        }

        public DbSet<AreaConocimientoBE> Areas { get; set; }
        public DbSet<CursoBE> Cursos { get; set; }
        public DbSet<PrerequisitoBE> Prerequisitos { get; set; }
        public DbSet<SilaboBE> Silabos { get; set; }
        public DbSet<CursoSilaboBE> CursosSilabos { get; set; }
        public DbSet<BibliografiaBE> Bibliografias { get; set; }
        public DbSet<SilaboBibliografiaBE> SilabosBibliografias { get; set; }
        public DbSet<EvaluacionBE> Evaluaciones { get; set; }
        public DbSet<EvaluacionSilaboBE> SilaboEvaluaciones { get; set; }
        public DbSet<UnidadAprendizajeBE> Unidades { get; set; }
        public DbSet<CarreraBE> Carreras { get; set; }
        public DbSet<ObjetivoCarreraBE> Objetivos { get; set; }
        public DbSet<PlanCurricularBE> PlanCurricular { get; set; }
        public DbSet<ItinerarioFormativoBE> Itinerarios { get; set; }
        public DbSet<PeriodoAcademicoBE> Periodos { get; set; }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
            
            modelBuilder.Configurations.Add(new AreaConocimientoMap());
            modelBuilder.Configurations.Add(new CursoMap());
            modelBuilder.Configurations.Add(new PrerequisitoMap());
            modelBuilder.Configurations.Add(new SilaboMap());
            modelBuilder.Configurations.Add(new CursoSilaboMap());
            modelBuilder.Configurations.Add(new BilbliografiaMap());
            modelBuilder.Configurations.Add(new SilaboBibliografiaMap());
            modelBuilder.Configurations.Add(new EvaluacionMap());
            modelBuilder.Configurations.Add(new EvaluacionSilaboMap());
            modelBuilder.Configurations.Add(new UnidadAprendizajeMap());
            modelBuilder.Configurations.Add(new CarreraMap());
            modelBuilder.Configurations.Add(new ObjetivoCarreraMap());
            modelBuilder.Configurations.Add(new PlanCurricularMap());
            modelBuilder.Configurations.Add(new ItinerarioFormativoMap());
            modelBuilder.Configurations.Add(new PeriodoAcademicoMap());
            
            base.OnModelCreating(modelBuilder);
        }
    }
}
